package com.file;

import java.io.*;

public class FileHelper {

    public static boolean copy(File file1, File file2, Integer) {
        String fromString = file1.readToString();
        boolean result = file2.writeString(fromString);

        return result;
    }

    public static void main(String[] args) {
        File file1 = new File("file1.txt");
        File file2 = new File("file2.txt");
        String fileString1 = file1.readToString();
        String fileString2 = file2.readToString();
        System.out.println("file1字符串如下：" + fileString1);
        System.out.println("file2字符串如下：" + fileString2);
        boolean copyResult = FileHelper.copy(file1, file2);

        String newFileString = file2.readToString();
        System.out.println("新的file2字符串如下：" + newFileString);
    }
}
